﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function PreviewTheme() {
            var theme = document.getElementById('Theme').value;
            var path = '../../?theme=' + theme;
            window.open(path);
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <ul id="submenu">
        <li><%= Html.ActionLink(Html.Translate("Controls"), "Controls", "Admin", null, new { id = "controls" })%></li>
        <li><%= Html.ActionLink(Html.Translate("Settings"), "Settings", "Admin", null, new { id = "settings" })%></li>
    </ul>
    
    <h2><%= Html.Translate("Settings") %></h2>
    <form action="<%= Url.Action("Settings","Admin") %>" method="post">
    <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td>
                <div class="postfields">
                <div class="settings">
                    <h1><%=Resources.labels.basic %> <%=Resources.labels.settings.ToLowerInvariant() %></h1>
                    <label for="Name"><%=Resources.labels.name %></label>
                    <%= Html.TextBox("Name", BlogSettings.Instance.Name) %>
                    <br />
                    
                    <label for="Description"><%=Resources.labels.description %></label>
                    <%= Html.TextBox("Description", BlogSettings.Instance.Description)%><br />
                    
                    <label for="PostsPerPage"><%=Resources.labels.postPerPage %></label>
                    <%= Html.TextBox("PostsPerPage", BlogSettings.Instance.PostsPerPage.ToString())%><br />
                    
                    <label for="Theme"><%=Resources.labels.theme %></label>
                    <%= Html.DropDownList("Theme", ViewData["Themes"] as SelectList, Resources.labels.theme) %>
                    <a href="javascript:void(PreviewTheme());">Preview</a> | 
                    <a href="http://www.dotnetblogengine.net/page/themes.aspx" target="_blank">Download</a><br />
                    
                    <label for="MobileTheme"><%=Resources.labels.mobileTheme %></label>
                    <%= Html.DropDownList("MobileTheme", ViewData["Themes"] as SelectList, Resources.labels.theme)%><br />
                    
                    <label for="UseBlogNameInPageTitles"><%=Resources.labels.useBlogNameInPageTitles%></label>
                    <%= Html.CheckBox("UseBlogNameInPageTitles", BlogSettings.Instance.UseBlogNameInPageTitles)%><%=Resources.labels.useBlogNameInPageTitlesDescription%><br />
                    
                    <%--<label for="EnableReg"><%=Resources.labels.enableReg%></label>
                    <%= Html.CheckBox("EnableReg", BlogSettings.Instance.EnableReg)%><br />--%>
                    
                    <label for="EnableRelatedPosts"><%=Resources.labels.showRelatedPosts %></label>
                    <%= Html.CheckBox("EnableRelatedPosts",BlogSettings.Instance.EnableRelatedPosts) %><br />
                    
                    <label for="EnableRating"><%=Resources.labels.enableRating %></label>
                    <%= Html.CheckBox("EnableRating", BlogSettings.Instance.EnableRating)%><br />
                    
                    <label for="ShowDescriptionInPostList"><%=Resources.labels.showDescriptionInPostList %></label>
                    <%= Html.CheckBox("ShowDescriptionInPostList", BlogSettings.Instance.ShowDescriptionInPostList)%>
                    <br />
                    
                    <label for="TimeStampPostLinks"><%=Resources.labels.timeStampPostLinks %></label>
                    <%= Html.CheckBox("TimeStampPostLinks", BlogSettings.Instance.TimeStampPostLinks)%>
                    <br />
                    
                    <label for="ShowPostNavigation"><%=Resources.labels.showPostNavigation %></label>
                    <%= Html.CheckBox("ShowPostNavigation", BlogSettings.Instance.ShowPostNavigation)%>
                    <br />
                    
                    <label for="Culture"><%=Resources.labels.language %></label>
                    <%= Html.DropDownList("Culture", ViewData["Cultures"] as SelectList)%>
                    <br />
                    
                    <label for="Timezone"><%=Resources.labels.timezone %></label>
                    <%= Html.TextBox("Timezone", BlogSettings.Instance.Timezone.ToString())%> Server time: <%=DateTime.Now.ToShortTimeString() %>
                    
                </div>
                
                <div class="settings">
                    <h1><%=Resources.labels.advancedSettings %></h1>
                    
                    <label for="EnableHttpCompression"><%=Resources.labels.enableHttpCompression %></label>
                    <%= Html.CheckBox("EnableHttpCompression", BlogSettings.Instance.EnableHttpCompression)%>
                    <%=Resources.labels.enableHttpCompressionDescription %><br />
                    
                    <label for="RemoveWhitespaceInStyleSheets"><%=Resources.labels.trimStylesheet %></label>
                    <%= Html.CheckBox("RemoveWhitespaceInStyleSheets", BlogSettings.Instance.RemoveWhitespaceInStyleSheets)%>
                    <%=Resources.labels.trimStylesheetDescription %><br />
                    
                    <label for="CompressWebResource"><%=Resources.labels.compressWebResource %></label>
                    <%= Html.CheckBox("CompressWebResource", BlogSettings.Instance.CompressWebResource)%>
                    <%=Resources.labels.compressWebResourceDescription%><br />
                    
                    <label for="EnableOpenSearch"><%=Resources.labels.enableOpenSearch %></label>
                    <%= Html.CheckBox("EnableOpenSearch", BlogSettings.Instance.EnableOpenSearch)%>
                    <%=Resources.labels.enableOpenSearchDescription %><br />
                    
                    <label for="RequireSSLMetaWeblogAPI"><%=Resources.labels.requireSslForMetaWeblogApi %></label>
                    <%= Html.CheckBox("RequireSSLMetaWeblogAPI", BlogSettings.Instance.RequireSSLMetaWeblogAPI)%>
                    <%=Resources.labels.requireSslForMetaWeblogApiDescription%><br /><br />
                    
                    <label for=""><%=Resources.labels.enableTrackbacks %></label>
                    <%= Html.CheckBox("EnableTrackBackSend", BlogSettings.Instance.EnableTrackBackSend)%> <%=Resources.labels.send %> &nbsp;&nbsp;
                    <%= Html.CheckBox("EnableTrackBackReceive", BlogSettings.Instance.EnableTrackBackReceive)%> <%=Resources.labels.receive %><br />
                    
                    <label for=""><%=Resources.labels.enablePingbacks %></label>
                    <%= Html.CheckBox("EnablePingBackSend", BlogSettings.Instance.EnablePingBackSend)%> <%=Resources.labels.send %> &nbsp;&nbsp;
                    <%= Html.CheckBox("EnablePingBackReceive", BlogSettings.Instance.EnablePingBackReceive)%> <%=Resources.labels.receive %><br />
                    
                    <label for="HandleWwwSubdomain"><%=Resources.labels.handleWwwSubdomain %></label>
                    <span id="HandleWwwSubdomainSpan" class="inline">
                        <input id="HandleWwwSubdomain0" type="radio" value="remove" name="HandleWwwSubdomain"/>
                        <label for="HandleWwwSubdomain0" ><%=Resources.labels.remove %></label>
                        <input id="HandleWwwSubdomain1" type="radio" value="add" name="HandleWwwSubdomain"/>
                        <label for="HandleWwwSubdomain1" ><%=Resources.labels.enforce %></label>
                        <input id="HandleWwwSubdomain2" type="radio" value="" name="HandleWwwSubdomain"/>
                        <label for="HandleWwwSubdomain2" ><%=Resources.labels.ignore %></label>
                    </span>
                </div>
                <div class="settings">
                    <h1><%=Resources.labels.comments %></h1>
                    
                    <label for="IsCommentsEnabled"><%=Resources.labels.enableComments %></label>
                    <%= Html.CheckBox("IsCommentsEnabled", BlogSettings.Instance.IsCommentsEnabled)%>
                    <%=Resources.labels.enableCommentsDescription %><br />
                    
                    <label for="EnableCountryInComments"><%=Resources.labels.showCountryChooser %></label>
                    <%= Html.CheckBox("EnableCountryInComments", BlogSettings.Instance.EnableCountryInComments)%>
                    <%=Resources.labels.showCountryChooserDescription %><br />
                    
                    <label for="IsCoCommentEnabled"><%=Resources.labels.enableCoComments %></label>
                    <%= Html.CheckBox("IsCoCommentEnabled", BlogSettings.Instance.IsCoCommentEnabled)%><br />
                    
                    <label for="ShowLivePreview"><%=Resources.labels.showLivePreview %></label>
                    <%= Html.CheckBox("ShowLivePreview", BlogSettings.Instance.ShowLivePreview)%> <br />
                    
                    <label for="Avatar"><%=Resources.labels.avatars %></label>
                    <span id="SpanAvatar" class="inline">
                        <input id="Avatar0" type="radio" value="monster" name="Avatar"/>
                        <label for="Avatar0">MonsterID</label>
                        <input id="Avatar1" type="radio" value="wavatar" name="Avatar"/>
                        <label for="Avatar1">Wavatar</label>
                        <input id="Avatar2" type="radio" value="identicon" name="Avatar"/>
                        <label for="Avatar2">Identicon</label>
                        <input id="Avatar3" type="radio" value="none" name="Avatar"/>
                        <label for="Avatar3"><%=Resources.labels.none%></label>
                    </span>
                    <script type="text/javascript" language="javascript">
                        (function checkAvatar() {
                            var at = document.getElementsByName("Avatar");
                            for(var i=0; i<at.length; i++) {
                                if (at[i].value == "<%= BlogSettings.Instance.Avatar %>") {
                                    at[i].checked = true;
                                }
                            }
                        })();
                     </script><br />
                    <%-- %><%= Html.RadioButtonList("HandleWwwSubdomain", 
                        new Dictionary<string, object> { { "MonsterID", "monster" }, { "Wavatar", "wavatar" }, { "Identicon", "identicon" }, { Resources.labels.none, "none" } }, BlogSettings.Instance.Avatar)%><br />
                    --%>
                    <label for="EnableCommentsModeration"><%=Resources.labels.enableCommentsModeration%></label>
                    <%= Html.CheckBox("EnableCommentsModeration", BlogSettings.Instance.EnableCommentsModeration)%><br />
                    
                    <label for="DaysCommentsAreEnabled">
                        <%=Resources.labels.closeCommetsAfter %>
                    </label>
                     <select id="DaysCommentsAreEnabled" name="DaysCommentsAreEnabled">
                        <option value="0" selected="selected">Never</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="7">7</option>
                        <option value="10">10</option>
                        <option value="14">14</option>
                        <option value="21">21</option>
                        <option value="30">30</option>
                        <option value="60">60</option>
                        <option value="90">90</option>
                     </select>
                     days.
                     <script type="text/javascript" language="javascript">
                        document.getElementById("DaysCommentsAreEnabled").options["<%= BlogSettings.Instance.DaysCommentsAreEnabled %>"].selected=true;
                     </script>
                    
                </div>
                <div class="settings">
                    <h1>E-mail</h1>
                    
                    <label for="Email"><%=Resources.labels.emailAddress %></label>
                    <%= Html.TextBox("Email", BlogSettings.Instance.Email)%><br />
                    
                    <label for="SmtpServer">SMTP server</label>
                    <%= Html.TextBox("SmtpServer", BlogSettings.Instance.SmtpServer)%> <br />
                    
                    <label for="SmtpServerPort"><%=Resources.labels.portNumber %></label>
                    <%= Html.TextBox("SmtpServerPort", BlogSettings.Instance.SmtpServerPort.ToString())%>
                    <%=Resources.labels.portNumberDescription %> <br />
                    
                    <label for="SmtpUserName"><%=Resources.labels.userName %></label>
                    <%= Html.TextBox("SmtpUserName", BlogSettings.Instance.SmtpUserName)%> <br />
                    
                    <label for="SmtpPassword"><%=Resources.labels.password %></label>
                    <%= Html.TextBox("SmtpPassword", BlogSettings.Instance.SmtpPassword)%> <br />
                    
                    <label for="EnableSsl"><%=Resources.labels.enableSsl%></label>
                    <%= Html.CheckBox("EnableSsl", BlogSettings.Instance.EnableSsl)%> <br />
                    
                    <label for="SendMailOnComment"><%=Resources.labels.sendCommentEmail %></label>
                    <%= Html.CheckBox("SendMailOnComment", BlogSettings.Instance.SendMailOnComment)%> <br />
                    
                    <label for="EmailSubjectPrefix"><%=Resources.labels.emailSubjectPrefix %></label>
                    <%= Html.TextBox("EmailSubjectPrefix", BlogSettings.Instance.EmailSubjectPrefix)%> <br /><br />
                    
                    <input type="button" id="btnTestSmtp" value="Test mail settings" />
                    <span id="SmtpStatus"></span>
                </div>
                <div class="settings">
                    <h1>Feed <%=Resources.labels.settings.ToLowerInvariant() %>
                    </h1>
                    <label for="SyndicationFormat"><%=Resources.labels.defaultFeedOutput %></label>
                    <select id="SyndicationFormat" name="SyndicationFormat">
                        <option value="RSS">RSS 2.0</option>
                        <option value="Atom">Atom 1.0</option>
                     </select>
                    format.<br /><br />
                    
                    <label for="PostsPerFeed"><%=Resources.labels.postsPerFeed %></label>
                    <%= Html.TextBox("PostsPerFeed", BlogSettings.Instance.PostsPerFeed.ToString())%>
                    <br />
                    
                    <label for="AuthorName"><%=Resources.labels.author %></label>
                    <%= Html.TextBox("AuthorName", BlogSettings.Instance.AuthorName)%> <br />
                    
                    <label for="Language"><%=Resources.labels.languageCode %></label>
                    <%= Html.TextBox("Language", BlogSettings.Instance.Language)%>
                    <br /><br />
                    
                    <label for="GeocodingLatitude"><%=Resources.labels.latitude %></label>
                    <%= Html.TextBox("GeocodingLatitude", BlogSettings.Instance.GeocodingLatitude.ToString())%> <br />
                    
                    <label for="GeocodingLongitude"><%=Resources.labels.longtitude %></label>
                    <%= Html.TextBox("GeocodingLongitude", BlogSettings.Instance.GeocodingLongitude.ToString())%>
                    <br /><br />
                    
                    <label for="EnableEnclosures">Enable Enclosures</label>
                    <%= Html.CheckBox("EnableEnclosures", BlogSettings.Instance.EnableEnclosures)%> <br />
                    
                    <label for="Endorsement"><%=Resources.labels.endorsment %></label>
                    <%= Html.TextBox("Endorsement", BlogSettings.Instance.Endorsement)%> <br />
                    
                    <label for="AlternateFeedUrl"><%=Resources.labels.alternateFeedUrl %></label>
                    <%= Html.TextBox("AlternateFeedUrl", BlogSettings.Instance.AlternateFeedUrl)%>
                    <em>(http://feeds.feedburner.com/username)</em>
                </div>
                <div class="settings">
                    <h1>
                        <%=Resources.labels.htmlHeadSection %>
                    </h1>
                    <label for="HtmlHeader">
                        <%=Resources.labels.addCustomCodeToHeader %>
                    </label>
                    <%= Html.TextArea("HtmlHeader", BlogSettings.Instance.HtmlHeader, new Dictionary<string, object> { { "rows", 9 }, { "cols", 30 }, { "style", "width:500px" } })%>
                    
                </div>
                <div class="settings">
                    <h1>Tracking script</h1>
                    <label for="TrackingScript">
                      Visitor tracking script<br /><br />The JavaScript code from i.e. Google Analytics.<br /><br />
                      Will be added in the bottom of each page regardless of the theme.<br /><br />(remember to add the &lt;script&gt; tags)</label>
                    <%= Html.TextArea("TrackingScript", BlogSettings.Instance.TrackingScript, new Dictionary<string, object> { { "rows", 11 }, { "cols", 30 }, { "style", "width:500px" } })%>
                </div>
                
                <div class="settings">
                  <h1><%=Resources.labels.import %> & <%=Resources.labels.export %></h1>
                  <p>
                    <%=Resources.labels.blogMLDescription %>
                    (<a href="http://blogml.org/" target="_blank">blogml.org</a>)
                  </p>
                  <input type="button" value="<%=Resources.labels.import %>" onclick="location.href='http://dotnetblogengine.net/clickonce/blogimporter/blog.importer.application?url=<%=Utils.AbsoluteWebRoot %>&username=<%=Page.User.Identity.Name %>'" />&nbsp;&nbsp;
                  <input type="button" value="<%=Resources.labels.export %>" onclick="location.href='blogml.axd'" />
                </div>
                
                <div align="right">
                    <div class="buttons">
                        <button type="submit" class="positive">
                            <img src="../../Content/icons/tick.png" alt="" />
                            <%= Resources.labels.save + " " + Resources.labels.settings %>
                        </button>
                    </div>
                </div>
                </div>
            </td>
            <td id="tdsubmitbox" valign="top">
                <div id="submitbox">
                    <div class="buttons">
                        <button type="submit" class="positive">
                            <img src="../../Content/icons/tick.png" alt="" />
                            <%= Resources.labels.save + " " + Resources.labels.settings %>
                        </button>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    </form>
    <script type="text/javascript" language="javascript">
        checkRadioList("HandleWwwSubdomain", "<%= BlogSettings.Instance.HandleWwwSubdomain %>");
        checkRadioList("SyndicationFormat", "<%= BlogSettings.Instance.SyndicationFormat %>");
        function checkRadioList(name, val) {
            var at = document.getElementsByName(name);
            for (var i = 0; i < at.length; i++) {
                if (at[i].value == val) {
                    at[i].checked = true;
                }
            }
        }
        
        SetCurrentTag("setting");
        SetCurrentTag("settings");
    </script>
</asp:Content>
